<%--
  Created by IntelliJ IDEA.
  User: 刘邓
  Date: 2023-12-09
  Time: 17:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>导入课程信息</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        h2 {
            text-align: center;
        }
        .container {
            width: 400px; /* 设置容器宽度 */
            margin: 20px auto; /* 水平居中 */
            padding: 20px; /* 设置内边距 */
            border: 1px solid #ccc; /* 设置边框颜色 */
            border-radius: 5px; /* 设置边框圆角 */
        }

        .form-group {
            margin-bottom: 15px; /* 设置每个表单组的底部边距 */
        }

        .form-group label {
            display: block; /* 将标签显示为块级元素 */
            font-weight: bold; /* 设置字体加粗 */
        }

        .form-control {
            width: 100%; /* 设置输入框宽度为100% */
            padding: 10px; /* 设置输入框内边距 */
            border: 1px solid #ccc; /* 设置输入框边框颜色 */
            border-radius: 5px; /* 设置输入框边框圆角 */
        }
    </style>
</head>
<body>
<form action="/course/import" enctype="multipart/form-data" method="post" class="container">

    <h2>导入excel</h2>

    <div class="form-group">

        <label for="excel">选择导入的excel:</label>

        <input type="file" name="uploadFile" id="excel" class="form-control">

    </div>

    <div style="text-align: center">

        <button type="submit" id="toImport" style="width: 100px;height: 50px;background-color: #fff" class="btn btn-primary">导入</button>

    </div>

</form>
</body>
<script>
    let toImport = document.getElementById("toImport");
    toImport.addEventListener("click",(evt)=>{
        let excel_str=document.getElementById("excel").value;
        if(excel_str===null||excel_str===""){
            alert("请选择导入的文件");
            evt.preventDefault();
            return;
        }
    })
</script>
</html>
